package leetcode.problems;

import org.junit.Test;

/**
 * Created by gmwang on 2018/7/25
 * 森林里的兔子
 */
public class _0830RabbitsInForest {
    /**
     *
     * In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Those answers are placed in an array.
     * 在森林里，每只兔子都有一些颜色。兔子的一些子集（可能全部）告诉你有多少其他兔子有和它们一样的颜色。这些答案排列成一个数组。
     * Return the minimum number of rabbits that could be in the forest.
     * 返回最小数量的兔子可能在森林中。
     * Examples:
     * Input: answers = [1, 1, 2]
     * Output: 5
     * Explanation:
     * The two rabbits that answered "1" could both be the same color, say red.
     * 两个回答“1”的兔子都可以是相同的颜色，比如说红色。
     * The rabbit than answered "2" can't be red or the answers would be inconsistent.
     * 兔子回答“2”不能是红色或答案是不一致的。
     * Say the rabbit that answered "2" was blue.
     *  说回答“2”的兔子是蓝色的。
     * Then there should be 2 other blue rabbits in the forest that didn't answer into the array.
     * 那森林里还有2只蓝兔子，它们没有回答。
     * The smallest possible number of rabbits in the forest is therefore 5: 3 that answered plus 2 that didn't.
     * 因此，森林中最小的兔子数量可能是5个：3个回答，2个没有。
     *
     * Input: answers = [10, 10, 10]
     * Output: 11
     *
     * Input: answers = []
     * Output: 0
     * Note:
     *
     * answers will have length at most 1000.
     * Each answers[i] will be an integer in the range [0, 999].
    /**
     *
     * @param answers
     * @return
     */
    public int numRabbits(int[] answers) {
        return 0;
    }
    @Test
    public void test() {
        int[] A = {1,2,5};
        int res = numRabbits(A);
        System.out.println(res);
    }
}
